package com.tanhua.dubbo.api;

import com.itheima.model.dto.OptionsDto;
import com.itheima.model.pojo.Options;
import com.tanhua.dubbo.mapper.OptionsMapper;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class OptionsApiImpl implements OptionsApi {

    @Autowired
    private OptionsMapper optionsMapper;

    @Override
    public List<Options> findByQuestionId(Long id) {
        return optionsMapper.findList(id);
    }

    @Override
    public void insert(Options options) {
        optionsMapper.insertOptions(options);
    }

    @Override
    public Options findByIdAndQuestionId(OptionsDto answer) {
        return optionsMapper.findByIdAndQuestionsId(answer.getOptionId(), answer.getQuestionId());
    }
}
